<?php

namespace app\api\controller;

use app\api\model\Goods as GoodsModel;
use app\common\controller\Api;

class Goods extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function List()
    {
        $param = $this->request->param();
        $GoodsModel = new GoodsModel();

        if(!empty($param['c_id'])){
            $where['category_id']=$param['c_id'];
        }
        $where['deletetime']=null;
        $list=$GoodsModel->where($where)->order('weigh desc')->paginate();
        $this->success('',$list);
    }
    public function Details()
    {
        $param = $this->request->param();
        $GoodsModel = new GoodsModel();
        $where['id']=$param['id'];
        $where['deletetime']=null;
        $find=$GoodsModel->where($where)->find();
        $this->success('',$find);
    }
}
